{% macro normal(limit, total, endpoint, url_params=None, paging=3) %}
	{% set url_params = url_params or {} %}
	{% set page = (request.args.get('page') or 1)|int %}
	{% set item_start = (page - 1) * limit + 1 %}
	{% set max_page = (total - 1) // limit + 1 %}
	{% set item_end = total if item_start + limit >= total else item_start + limit - 1 %}
	<table class="pager">
		<tr>
		{% if 2 <= page %}
			<td><span class="bt">
				{% if 2 == page %}
					{{ link_to('＜前へ', url(endpoint, **url_params)) }}
				{% else %}
					{{ link_to('＜前へ', url(endpoint, page=page - 1, **url_params)) }}
				{% endif %}
			</span></td>
			<td><span class="bt">{{ link_to('1', url(endpoint, **url_params)) }}</span></td>
		{% else %}
			<td><span class="off">＜前のページ</span></td>
		{% endif %}
		
		{% for i in range(paging, 0, -1) if 1 < (page - i) %}
			{% if loop.first and page - paging >= 3 %}<td><span>･･･</span></td>{% endif %}
			<td><span class="bt">{{ link_to(page - i, url(endpoint, page=page - i, **url_params)) }}</span></td>
		{% endfor %}

		<td><span class="on">{{ page }}</span></td>

		{% for i in range(1, paging + 1) if (page + i) < max_page %}
			<td><span class="bt">{{ link_to(page + i, url(endpoint, page=page+i, **url_params)) }}</span></td>
			{% if loop.last and page <= max_page - 5 %}<td><span>･･･</span></td>{% endif %}
		{% endfor %}

		{% if max_page and page < max_page %}
			<td><span class="bt">{{ link_to(max_page, url(endpoint, page=max_page, **url_params)) }}</span></td>
			<td class="p_not"><span class="bt">{{ link_to('次へ＞', url(endpoint, page=page + 1, **url_params)) }}</span></td>
		{% else %}
			<td class="p_not"><span class="off">次へ＞</span></td>
		{% endif %}
		</tr>
	</table>
	{% if total %}
		<div class="center" style="line-height:100%;">
			{{ total }}件中　{{ item_start }} ～ {{ item_end }}件目を表示
		</div>
	{% endif %}
{% endmacro %}
